using System;
using CodePlex.DnD4eCampaignManager.DnD4e;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;
using NUnit.Framework;

namespace CodePlex.DnD4eCampaignManager.CampaignManagerTests.DnD4eTests
{
    [TestFixture]
    public class AbilitiesTests
    {
        [Test]
        public void HasAbilitiesCharisma()
        {
            const int charisma = 15;
            Abilities abilities = new Abilities { AbilityCharisma = charisma };
            Assert.AreEqual(charisma, abilities.AbilityCharisma);
        }

        [Test]
        public void HasAbilitiesConstitution()
        {
            const int constitution = 15;
            Abilities abilities = new Abilities { AbilityConstitution = constitution };
            Assert.AreEqual(constitution, abilities.AbilityConstitution);
        }

        [Test]
        public void HasAbilitiesDexterity()
        {
            const int dexterity = 15;
            Abilities abilities = new Abilities { AbilityDexterity = dexterity };
            Assert.AreEqual(dexterity, abilities.AbilityDexterity);
        }

        [Test]
        public void HasAbilitiesIntelligence()
        {
            const int intelligence = 15;
            Abilities abilities = new Abilities { AbilityIntelligence = intelligence };
            Assert.AreEqual(intelligence, abilities.AbilityIntelligence);
        }

        [Test]
        public void HasAbilitiesStrength()
        {
            const int strength = 15;
            Abilities abilities = new Abilities { AbilityStrength = strength };
            Assert.AreEqual(strength, abilities.AbilityStrength);
        }

        [Test]
        public void HasAbilitiesWisdom()
        {
            const int wisdom = 15;
            Abilities abilities = new Abilities { AbilityWisdom = wisdom };
            Assert.AreEqual(wisdom, abilities.AbilityWisdom);
        }

        [Test]
        public void ImplementsIAbilities()
        {
            Assert.IsInstanceOfType(typeof ( IAbilities ), new Abilities());
        }

        [Test]
        public void ImplementsIEquatable()
        {
            Assert.IsInstanceOfType(typeof ( IEquatable<Abilities> ), new Abilities());
        }

        [Test]
        public void IsEquatable()
        {
            Abilities primaryDomainObject = new Abilities { AbilityCharisma = 12 };
            Abilities duplicateDomainObject = new Abilities { AbilityCharisma = 12 };
            Abilities differentDomainObject = new Abilities { AbilityCharisma = 13 };
            
            TestHelpers.TestEquatabilityExcludingOperators(primaryDomainObject, duplicateDomainObject, differentDomainObject);
            Assert.IsTrue(primaryDomainObject == duplicateDomainObject);
            Assert.IsTrue(primaryDomainObject != differentDomainObject);
        }
    }
}